#include "testexec.h"
#include <QLineEdit>

testExec::testExec(QWidget *parent) : QWidget(parent)
{
    connect(&m_pro, SIGNAL(readyReadStandardOutput()), this,    SLOT(OnFromStdOut()));
    connect(&m_pro, SIGNAL(readyReadStandardError()), this,    SLOT(OnFromStdErr()));
    connect(&m_pro, SIGNAL(error(QProcess::ProcessError)), this, SLOT(OnError(QProcess::ProcessError)));
    connect(&m_pro, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(OnFinished(int,QProcess::ExitStatus)));
}

void testExec::OnFromStdOut()
{
    //ui.textBrowse->append(mProcess.readAllStandardOutput());
}

void testExec::OnFromStdErr()
{
    //ui.textBrowse->append(mProcess.readAllStandardError());
}

void testExec::OnError(QProcess::ProcessError error)
{
    if(error==QProcess::FailedToStart)
    {
        //ui.textBrowse->append("<font color=red>程序启动失败.</font>/r/n");
    }
}

void testExec::OnFinished(int exitCode, QProcess::ExitStatus exitStatus)
{
    if(exitStatus == QProcess::CrashExit)
    {
        //ui.textBrowse->append("<font color=red>程序异常终止.</font>/r/n");
    }
    else
    {
        //ui.textBrowse->append("<font color=green>程序正常结束.</font>/r/n");
    }
}
